/*
 * File:   server.c
 * Author: Miroslav
 *
 * Created on May 23, 2009, 11:04 PM
 */

#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>

#define MYPORT 3334

/*
 *
 */
int main(int argc, char** argv) {

    int sockfd;
    struct sockaddr_in my_addr;

//    sockfd = socket(AF_INET, SOCK_STREAM, 0);
    if (sockfd = socket(AF_INET, SOCK_STREAM, 0) == -1) {
        perror("Server-socket() error!");
        exit(1);
    } else
        printf("Server-socket() sockfd is OK!\n");

    my_addr.sin_family = AF_INET;
    my_addr.sin_port = htons(MYPORT);
    my_addr.sin_addr.s_addr = INADDR_ANY;


    if(bind(sockfd,(struct sockaddr_in *) &my_addr,sizeof(struct sockaddr_in))==-1){
        perror("Server-bind() error!");
        exit(1);
    }else
        printf("Server-bind() is OK!");


    return (EXIT_SUCCESS);
}
